package com.gzz.orchid.common.webmvc.securityjwt;

import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.List;

/**
 * @author higmd
 */
@Data
public class AuthenticationDetial implements UserDetails {
    // 用户名
    String username;
    // 密码
    String password;
    // 账号是否可用
    boolean enabled;
    // 账号是否未过期
    boolean accountNonExpired;
    // 账号是否未锁定
    boolean accountNonLocked;
    // 密码是否未过期
    boolean credentialsNonExpired;
    // 权限
    private List<? extends GrantedAuthority> authorities;

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return authorities;
    }

    @Override
    public String getPassword() {
        return password;
    }

    @Override
    public String getUsername() {
        return username;
    }
}
